Skip to content

Modernize the guide into community-editable chapters - #19

Merged
tuladhar merged 3 commits into
mainfrom
agent/modernize-chapters
Nov 20, 2026
Merged

tuladhar merged 3 commits into
mainfrom
agent/modernize-chapters

Conversation

@tuladhar

Copy link
Copy Markdown
Owner

Turns the single 1,170-line README into a modern, community-driven guide that also powers the new website at https://purutuladhar.com/python-for-sys-admin/.

What changed

  • 14 Markdown chapters in chapters/, ordered by chapters/chapters.json. The website loads them live from main, so merged contributions show up on the site automatically.
  • Modernized for Python 3.10+: subprocess.run() instead of call/check_output, pathlib, print(..., file=sys.stderr), OSError, encoding="utf-8", UTC-aware datetime, tempfile.mkstemp instead of the removed os.tmpnam, and docs links moved from 3.7 to 3.
  • Fixed bugs in the old examples (e.g. len(argv) NameError, missing f prefix in 'error: {error}', writing bytes to a text file).
  • New content: lab setup with the free iximiuz Labs Python Playground, a full SQLite chapter, a socket/network checks chapter, and rewritten JSON and CSV chapters.
  • examples/ synced with the chapter scripts. All of them were run locally.
  • Community: CONTRIBUTING.md, a chapter issue template, and a "help wanted" list of 16 topics shown on the website.
  • New README with links to the website and playground, the /step-by-step skill, and a request to star the repo.

Merge order

Merge this before the personal-website PR, because the site reads chapters/chapters.json from main.

Follow-up

  • Add assets/playground-demo.gif. The website shows it automatically once it exists. Then uncomment the GIF line in chapters/01-set-up-your-lab.md.

🤖 Generated with Claude Code

tuladhar and others added 3 commits November 20, 2026 15:46
- Split README into 14 Markdown chapters under chapters/ with a chapters.json
  manifest that powers purutuladhar.com/python-for-sys-admin
- Rewrite content for Python 3.10+: subprocess.run, pathlib, f-strings,
  OSError, UTC datetimes, fixed broken examples
- New chapters/sections: lab setup (iximiuz Labs playground), SQLite, socket
- Sync examples/ with chapter scripts (all verified to run)
- Add CONTRIBUTING.md, chapter issue template and help-wanted list
- New README with website, playground, /step-by-step skill and star CTA

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tested on the iximiuz Labs Python playground (Ubuntu 24.04, Python 3.14):
- port_check.py hung on google.com:81 (timeout per resolved address);
  use github.com targets and a 3s timeout, explain the pitfall
- sweep.py scanned a hard-coded 10.0.0.0/24; take NETWORK and PORT args
- nested_sequences_flattened.py: collections.Iterable was removed, and the
  generator yielded sublists too
- remove snmp_discover.py (imports modules that never existed) and
  sys_02.py (duplicate of argv_02.py)
- make every inline snippet self-contained; replace bc (not installed)
  with sort in the subprocess input example
- require Python 3.11+ (datetime.UTC)
- add scripts/test_examples.sh, scripts/check_snippets.py and a GitHub
  Actions workflow that runs both on 3.11 and 3.14

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/etc/ssh contains root-only host keys, so make_archive raised
PermissionError for normal users (caught by testing in the playground).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tuladhar

Copy link
Copy Markdown
Owner Author

Tested end to end in the iximiuz Labs Python playground (Ubuntu 24.04), on Python 3.14.10 and the system Python 3.12.3:

  • scripts/test_examples.sh: 34 passed, 0 failed (every script in examples/, with expected exit codes)
  • python3 scripts/check_snippets.py: 0 failures (every inline snippet in chapters/)
  • GitHub Actions: passing on 3.11 and 3.14

Fixed along the way: port_check.py hang, sweep.py hard-coded network, nested_sequences_flattened.py (removed collections.Iterable and a logic bug), a PermissionError in the shutil snippet, and snippets that weren't self-contained. Removed snmp_discover.py (imports modules that don't exist) and sys_02.py (a duplicate of argv_02.py). The minimum is now Python 3.11 because the chapters use datetime.UTC.

Until this is merged, main still has the old examples/grep.py, which fails with a SyntaxError.

🤖 Generated with Claude Code

@tuladhar
tuladhar merged commit 6a0cd58 into main Nov 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant